/*
 * Copyright (c) 2019 Hitevision
 */

package tw.com.hitevision.whiteboard.android;

import android.os.Build;

import tw.com.hitevision.whiteboard.android.util.SystemPropertiesUtils;

public class Props {
    /** Current build flavor model. */
    public static String getFlavorModel() {
        return BuildConfig.FLAVOR_model;
    }
    /** Current build flavor chipset. */
    public static String getFlavorChipset() {
        return BuildConfig.FLAVOR_chipset;
    }

    /** Current build phase. */
    public static int getPhase() {
        return FlavorProps.BUILD;
    }

    /** Current mainboard version. */
    public static int getMainboardVersion() {
        return getFlavorChipset().equals(Flavor.Chipset.Hisi) ? Mainboard.V_811
                : Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP ? Mainboard.V_828 : Mainboard.V_848;
    }

    /** Use Paint Helper to draw lines. */
    public static boolean isPaintHelperEnabled() {
        // painthelper is only supported on mstar devices
        return !getFlavorChipset().equals(Flavor.Chipset.Chrome)&& FlavorProps.PAINT_HELPER_ENABLED;
    }

    /** Define browser used by image search. */
    public static int getImageSearchBrowser() {
        return FlavorProps.IMAGE_SEARCH_BROWSER;
    }

    public static String getMountFolder() {
        return FlavorProps.MOUNT_FOLDER;
    }

    public static int getFiveFingerGestureMode() {
        return FlavorProps.FIVE_FINGER_GESTURE;
    }

    public static boolean isFake4k() {
        if (Props.getFlavorChipset().equals(Flavor.Chipset.Amlogic) || Props.getFlavorChipset().equals(Flavor.Chipset.Optoma)) {
            return false;
        } else {
            return Props.getMainboardVersion() == Props.Mainboard.V_811 || SystemPropertiesUtils.getBooleanValue(SystemPropertiesUtils.KEY_8386_4k2k, false);
        }
    }
    /** check if Web image is enabler*/
    public static boolean isWebImageEnable() {
        return FlavorProps.WEB_IMAGE_ENABLE ;
    }

    /** check if visualizer is enabled */
    public static boolean isVisualizerEnabled() {
        return FlavorProps.VISUALIZER_ENABLE && Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP;
    }

    /** check if split mode is enabled */
    public static boolean isSplitModeEnabled() {
        return FlavorProps.SPLIT_MODE_ENABLED;
    }

    /** This class holds all possible build phases. */
    public static class Phase {
        public static final int TWO = 1;
        public static final int THREE = 2;
        public static final int FOUR = 3;
    }

    public static class Flavor {
        public static class Model {
            public static final String Oem = "oem";
            public static final String Rs = "rs";
            public static final String Wcd = "wcd";
            public static final String Xvn = "xvn";
            public static final String NewlineChinaYi = "newline_china_yi";
        }

        public static class Chipset {
            public static final String Mstar = "mstar";
            public static final String Hisi = "hisi";
            public static final String Chrome = "chrome";
            public static final String Amlogic = "amlogic";
            public static final String Optoma = "optoma";
        }
    }

    public static class Mainboard {
        public static final int V_828 = 101;
        public static final int V_848 = 102;

        public static final int V_810 = 201;
        public static final int V_811 = 202;
    }

    public static class Browser {
        public static final int CHROME = 1;
        public static final int BING = 2;
        public static final int BAIDU = 3;
    }

    public static class Gesture {
        public static final int ERASER = 1;
        public static final int SCROLL = 2;
    }

    //if firmware is oem ,Platforms2 will contains this string determined by model 19A or 19B
    public static class OEM_Model {
        public static final String MODEL_19A = "OEM_MS";
        public static final String MODEL_19B = "OEMB_MS";
    }
}
